using System;
using System.Linq;
using System.Linq.Expressions;

namespace FreshMeat.Xaml
{
   public static class PropertyAccessor
   {
      public static string[] GetNames<T>(params Expression<Func<T>>[] propertyExpression)
      {
         return propertyExpression.Select(GetName).ToArray();
      }

      public static string GetName<T>(Expression<Func<T>> propertyExpression)
      {
         return ((MemberExpression)propertyExpression.Body).Member.Name;
      }
   }
}